<?php

// Acceso restringido
defined('JL') or die('Acceso restringido');

class PresentationController extends JLControllerBase {

    private $config = null;
    private $path = "Presentation";
    private $title = "Système d'Actualisation CSME > Présentation";
    private $data = null;

    /**
     * Funcion por defecto para los controladores
     * @Retorna No
     */
    public function Index() {
        require JLPATH_MODELS . DS . "LesCSMEModel.php";
        $LesCSME = new LesCSMEModel();
        $data['lesCSME'] = $LesCSME->getLesCSMEById(1);

        require JLPATH_MODELS . DS . "StateModel.php";
        $state = new StateModel();
        $states = $state->getStates();
        $data['states'] = $states;

        $data['texttitle'] = " > Pr&eacute;sentation";
        $data['classcurrent4'] = ' class="current"';
        $this->View->Show($this->path, $this->title, $data);
    }

    public function SaveLesCSME() {
        $txtpresentation = $_POST['_txtpresentation'];

        require JLPATH_MODELS . DS . "LesCSMEModel.php";
        $LesCSME = new LesCSMEModel();
        $_true = $LesCSME->updateLesCSME(1, $txtpresentation);
        if ($_true)
            echo "Données sauvegarder avec succès.";
        else
            echo "";
    }

    public function LaPresidence() {
        require JLPATH_MODELS . DS . "StateModel.php";
        $state = new StateModel();
        $states = $state->getStates();
        $data['states'] = $states;

        $data['texttitle'] = " > Pr&eacute;sentation";
        $data['classcurrent4'] = ' class="current"';
        $this->View->Show("LaPresidence", $this->title, $data);
    }

    public function Ancien() {
        require JLPATH_MODELS . DS . "StateModel.php";
        $state = new StateModel();
        $states = $state->getStates();
        $data['states'] = $states;

        $data['texttitle'] = " > Pr&eacute;sentation";
        $data['classcurrent4'] = ' class="current"';
        $this->View->Show("Ancien", $this->title, $data);
    }

}